import 'package:flutter/material.dart';

class HomeNav extends StatelessWidget {
  const HomeNav({super.key});

  // 菜单数据
  static List menuList = [
    {
      "title": "我的房屋",
      "icon": "assets/images/house_profile_icon@2x.png",
      'link': '/house_list',
    },
    {
      "title": "我的报修",
      "icon": "assets/images/repair_profile_icon@2x.png",
      'link': '/xxx',
    },
    {
      "title": "访客记录",
      "icon": "assets/images/visitor_profile_icon@2x.png",
      'link': '/xxx',
    }
  ];

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(10),
      decoration: BoxDecoration(
        color: Colors.white,
        borderRadius: BorderRadius.circular(10),
      ),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceAround,
        children: menuList
            .map(
              (item) => GestureDetector(
                onTap: () {
                  Navigator.pushNamed(context, item['link']);
                },
                child: Column(children: [
                  Image.asset(
                    item["icon"],
                    width: 32,
                    height: 32,
                  ),
                  // 间距
                  const SizedBox(height: 4),
                  Text(
                    item['title'],
                    style: const TextStyle(fontSize: 14),
                  )
                ]),
              ),
            )
            .toList(),
      ),
    );
  }
}
